<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isErrorPage="true" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>页面未找到 - 员工信息管理系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css">
    <style>
        .error-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 80vh;
            text-align: center;
            padding: 2rem;
        }

        .error-code {
            font-size: 6rem;
            font-weight: bold;
            color: #e74c3c;
            margin-bottom: 1rem;
        }

        .error-message {
            font-size: 1.5rem;
            color: #2c3e50;
            margin-bottom: 2rem;
        }

        .error-details {
            color: #7f8c8d;
            margin-bottom: 2rem;
            max-width: 500px;
        }

        .error-actions {
            display: flex;
            gap: 1rem;
            flex-wrap: wrap;
            justify-content: center;
        }

        @media (max-width: 768px) {
            .error-code {
                font-size: 4rem;
            }

            .error-message {
                font-size: 1.2rem;
            }
        }
    </style>
</head>
<body>
<div class="container">
    <header class="header">
        <h1>员工信息管理系统</h1>
        <div class="user-info">
            <%
                // 检查用户是否已登录
                Object user = session.getAttribute("user");
                if (user != null) {
                    out.print("欢迎, " + user.getClass().getMethod("getUsername").invoke(user));
                    out.print(" | <a href=\"" + request.getContextPath() + "/logout\">退出</a>");
                } else {
                    out.print("<a href=\"" + request.getContextPath() + "/login\">登录</a>");
                }
            %>
        </div>
    </header>

    <nav class="sidebar">
        <ul>
            <li><a href="${pageContext.request.contextPath}/dashboard">仪表板</a></li>
            <li><a href="${pageContext.request.contextPath}/employee">员工管理</a></li>
        </ul>
    </nav>

    <main class="main-content">
        <div class="error-container">
            <div class="error-code">404</div>
            <div class="error-message">页面未找到</div>
            <div class="error-details">
                抱歉，您访问的页面不存在。可能是URL输入错误，或者页面已被移动或删除。
            </div>
            <div class="error-actions">
                <a href="${pageContext.request.contextPath}/dashboard" class="btn btn-primary">返回首页</a>
                <a href="${pageContext.request.contextPath}/employee" class="btn btn-secondary">查看员工列表</a>
                <a href="javascript:history.back()" class="btn btn-info">返回上一页</a>
            </div>
        </div>
    </main>
</div>
</body>
</html>